package com.jt.demo3;

import com.jt.demo2.Pet;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import sun.applet.Main;

public class User {
    public static void main(String[] args) {
            //1.指定spring配置文件名称
            String resource = "spring.xml";
            //2.启动spring容器,需求xml配置文件信息. 实例化对象 交给容器管理
            ApplicationContext applicationContext = new ClassPathXmlApplicationContext(resource);
            //3.从容器中按照类型获取对象
            Dog dog = applicationContext.getBean(Dog.class);
            //4.对象调用方法
            dog.hello();
    }
}
